import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import type { App } from 'vue'
import { useGlobalStore } from './GlobalStore'

// 注册 pinia 插件
const Pinia = createPinia()
export { Pinia, useGlobalStore }

export function setupStore(app: App<Element>) {
	// 全局注册状态管理工具：pinia
	app.use(Pinia)
	Pinia.use(piniaPluginPersistedstate)
}
